package com.heima.wemedia.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.common.dtos.ResponseResult;
import com.heima.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.mapper.WmChannelMapper;
import com.heima.wemedia.service.WmChannelService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WmChannelServiceImpl extends ServiceImpl<WmChannelMapper, WmChannel> implements WmChannelService {
    @Override
    public ResponseResult<List<WmChannel>> findAll() {
        //全部查询
        List<WmChannel> list = this.lambdaQuery()
                .list();
        return ResponseResult.okResult(list);
    }

    @Override
    public ResponseResult<WmChannel> queryChannelById(Integer id) {
        WmChannel channel = null;
        try {
            channel = this.getById(id);
        } catch (Exception e) {
            return ResponseResult.errorResult(AppHttpCodeEnum.PARAM_REQUIRE);
        }
        return ResponseResult.okResult(channel);
    }



}
